package cn.kgc.web.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 课工场
 * @date 2024/10/8
 * @description  浏览器  /hello
 *  extends HttpServlet      HelloServlet 拥有处理http请求能力
 *
 *  /hello  请求方式  get    /add
 *  get
 *  post
 *  put
 *  delete
 */
public class HelloServlet extends HttpServlet {


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 获取请求方式  get  post
        String method = req.getMethod();
        System.out.println("hello javaWeb "+method);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 获取请求方式  get  post
        // String method = req.getMethod();
        // System.out.println("hello javaWeb "+method);
        doGet(req,resp);
    }

}
